buildscript {
    repositories {
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
    }
}

plugins {
    id 'com.github.johnrengelman.shadow' version '7.1.2'
    id 'java'
    id 'io.spring.dependency-management' version '1.1.0'
    id 'org.liquibase.gradle' version '2.2.0'
}

group = 'com.github.gypsyjr777'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.data:spring-data-jpa:3.1.5'
    implementation 'org.springframework.batch:spring-batch-integration:5.0.3'
    implementation 'org.springframework.boot:spring-boot-autoconfigure:3.1.5'
    implementation 'org.postgresql:postgresql:42.5.4'
    compileOnly 'org.projectlombok:lombok:1.18.30'
    annotationProcessor 'org.projectlombok:lombok:1.18.30'
    implementation 'net.dv8tion:JDA:5.0.0-beta.20'
    implementation 'org.liquibase:liquibase-core:4.23.0'
    implementation 'jakarta.persistence:jakarta.persistence-api:3.1.0'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.3'
    implementation 'org.hibernate.orm:hibernate-core:6.3.1.Final'
    implementation 'org.apache.logging.log4j:log4j-core:2.21.1'
    implementation 'org.apache.logging.log4j:log4j-api:2.21.1'

    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
}

jar {
    manifest {
        attributes "Main-Class": "com.github.gypsyjr777.discordmanager.DiscordManagerApplication"
    }

    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

task customFatJar(type: Jar) {
    manifest {
        attributes 'Main-Class': 'com.github.gypsyjr777.discordmanager.DiscordManagerApplication'
    }
    archiveBaseName = 'all-in-one-jar'
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar
}